//
//  RegistrationEmailCellViewModel.swift
//  PorscheRegistration
//
//  Created by Jinzhu Liu on 2023/11/16.
//

import Foundation
import Combine

protocol RegistrationEmailCellViewModelInputType: RegistrationTextFieldCellViewModelInputType {
    
}

protocol RegistrationEmailCellViewModelOutputType: RegistrationTitleCellViewModelOutputType,
                                                   RegistrationTextFieldCellViewModelOutputType {
    
}

protocol RegistrationEmailCellViewModelType: RegistrationCellViewModelType {
    var input: RegistrationEmailCellViewModelInputType { get }
    var output: RegistrationEmailCellViewModelOutputType { get }
}

class RegistrationEmailCellViewModel: RegistrationEmailCellViewModelType,
                                       RegistrationEmailCellViewModelInputType {
    var input: RegistrationEmailCellViewModelInputType { self }
    var output: RegistrationEmailCellViewModelOutputType { self }
    
    var title: String = "Email"
    var textFieldEnable: Bool = true
    @Published var textValue: String = ""
}

extension RegistrationEmailCellViewModel: RegistrationEmailCellViewModelOutputType {
    var textValuePublisher: AnyPublisher<String, Never> {
        $textValue.eraseToAnyPublisher()
    }
}
